import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '编号',
    align:"center",
    sorter: true,
    dataIndex: 'code',
    width: 100
   },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '分类体系',
    align:"center",
    dataIndex: 'marbasclassSystem',
    customRender: ({ text }) => {
      return render.renderDict(text, 'marbasclass_marbasclass_system');
    },
    width: 100
   },
  //  {
  //   title: '计量单位ID',
  //   align:"center",
  //   dataIndex: 'unitId'
  //  },
   {
    title: '分类计量单位',
    align:"center",
    dataIndex: 'unitName',
    width: 120
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'enableStatus',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'1'},{text:'否',value:'0'}])
     },
     width: 80
   },
   {
    title: '描述',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '第三方编码',
    align:"center",
    dataIndex: 'thirdPartyCode',
    width: 110
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "分类体系",
      field: 'marbasclassSystem',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"marbasclass_marbasclass_system"
      },
      colProps: {span: 6},
 	},
	{
      label: "编号",
      field: 'code',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "名称",
      field: 'name',
      component: 'Input',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '分类体系',
    field: 'marbasclassSystem',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"marbasclass_marbasclass_system",
        stringToNumber: true,
     },
    dynamicRules: ({}) => [{ required: true, message: '请输入分类体系!'}]
  },
  {
    label: '编号',
    field: 'code',
    component: 'Input',
    dynamicRules: ({}) => [{ required: true, message: '请输入编号!'}]},
  {
    label: '名称',
    field: 'name',
    component: 'Input',
    dynamicRules: () => [{ required: true, message: '请输入名称!'}]
  },
  {
    label: '计量单位ID',
    field: 'unitId',
    component: 'Input',
    show: false
  },
  {
    label: '分类计量单位',
    field: 'unitName',
    component: 'Input',
    slot: 'customSlot',
    dynamicRules: () => [{ required: true, message: '请输入分类计量单位!'}]
  },
  {
    label: '状态',
    field: 'enableStatus',
    defaultValue: 0,
     component: 'JSwitch',
     componentProps:{
         options:[1,0]
     },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '第三方编码',
    field: 'thirdPartyCode',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}